Cover | TOC | Chap | Prev Chap | Prev Fig | Next Fig | Next Chap |
|
Figure 8.7
Three interpolators used to rotate three bars. |
|
Click on the image to view the VRML scene. |
#VRML V2.0 utf8 # The VRML 2.0 Sourcebook # Copyright (c) 1997 # Andrea L. Ames, David R. Nadeau, and John L. Moreland Group { children [ # Three rotating bars DEF Bar1 Transform { children Shape { appearance DEF White Appearance { material Material { } } geometry Box { size 1.5 0.2 0.2 } } }, DEF Bar2 Transform { children Shape { appearance USE White geometry Box { size 0.2 1.5 0.2 } } }, DEF Bar3 Transform { children Shape { appearance USE White geometry Box { size 0.2 0.2 1.5 } } }, # Animation clock DEF Clock TimeSensor { cycleInterval 4.0 loop TRUE }, # Animation paths, one for each bar DEF BarPath1 OrientationInterpolator { key [ 0.0, 0.50, 1.0 ] keyValue [ 0.0 0.0 1.0 0.0, 0.0 0.0 1.0 3.14, 0.0 0.0 1.0 6.28 ] }, DEF BarPath2 OrientationInterpolator { key [ 0.0, 0.50, 1.0 ] keyValue [ 1.0 0.0 0.0 0.0, 1.0 0.0 0.0 3.14, 1.0 0.0 0.0 6.28 ] }, DEF BarPath3 OrientationInterpolator { key [ 0.0, 0.50, 1.0 ] keyValue [ 0.0 1.0 0.0 0.0, 0.0 1.0 0.0 3.14, 0.0 1.0 0.0 6.28 ] } ] } ROUTE Clock.fraction_changed TO BarPath1.set_fraction ROUTE Clock.fraction_changed TO BarPath2.set_fraction ROUTE Clock.fraction_changed TO BarPath3.set_fraction ROUTE BarPath1.value_changed TO Bar1.set_rotation ROUTE BarPath2.value_changed TO Bar2.set_rotation ROUTE BarPath3.value_changed TO Bar3.set_rotation